package Java8实战._1_并行流._3_正确使用并行流;


import java.util.stream.LongStream;

public class _3_正确使用并行流_1 {

    public static void main(String[] args) {
        System.out.println(sideEffectSum(5));
    }

    public static long sideEffectSum(long n){
        Accumulator accumulator = new Accumulator();
        LongStream.rangeClosed(1,n).forEach(accumulator::add);
        return accumulator.total;
    }


}













